]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
iconGrid/iconGridLayout: Make sure to always update best size
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 1 Dec 2020 01:14:17 +0000 (22:14 -0300)
committerMarge Bot <marge-bot@gnome.org>
Tue, 1 Dec 2020 18:57:49 +0000 (18:57 +0000)
When selecting the best icon size for the available area, we
iterate from the biggest icon size to the smallest one, and
stop when finding a size that fits the available area.

However, the 'bestSize' variable is only updated when the
available area is positive. This is problematic in super bad
cases like when none of the icon sizes actually fit the availabe
area, which was hit with a previous iteration of this branch.

Make sure to update the best size while iterating, so that the
smallest size is selected even in such bad cases.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1510>

js/ui/iconGrid.js

index 7275a6a41aa50fe04b4ea6d36b583e77ebc04f68..93fc6219fa5d6a3406b49f4a2d20609645161cd1 100644 (file)
@@ -429,10 +429,10 @@ var IconGridLayout = GObject.registerClass({
                 this._pageHeight - usedHeight -  rowSpacingPerPage -
                 this._pagePadding.top - this._pagePadding.bottom;
 
-            if (emptyHSpace >= 0 && emptyVSpace > 0) {
-                bestSize = size;
+            bestSize = size;
+
+            if (emptyHSpace >= 0 && emptyVSpace > 0)
                 break;
-            }
         }
 
         return bestSize;